package net.zjitc.service.impl;

import net.zjitc.mapper.CategoryMapper;
import net.zjitc.pojo.Category;
import net.zjitc.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author admin
 * @Date 2019/5/21 10:27
 */
@Service
@Transactional
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    CategoryMapper categoryMapper;
    @Override
    public List<Category> findAll() {
        return categoryMapper.findAll();
    }

    @Override
    public Category findById(Integer cid) {
        if (cid == null)
        {
            Category category = new Category();
            category.setName("全部商品目录");
            return category;
        }
        return categoryMapper.findById(cid);
    }
}
